home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11168 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: dispatch.news.demon.net!demon!redifon.demon.co.uk
  2. From: Guy Pickering <gp@redifon.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Wierd const problem (repost)
  5. Date: Fri, 22 Mar 1996 07:56:17 GMT
  6. Organization: Redifon MEL Ltd
  7. Message-ID: <827481377.25066@redifon.demon.co.uk>
  8. NNTP-Posting-Host: redifon.demon.co.uk
  9. X-NNTP-Posting-Host: redifon.demon.co.uk
  10. X-Mailer: Mozilla 1.1N (X11; I; SunOS 4.1.3_U1 sun4c)
  11. MIME-Version: 1.0
  12. X-URL: news:comp.lang.c
  13. Content-Transfer-Encoding: 7bit
  14. Content-Type: text/plain; charset=us-ascii
  15.  
  16. If I declare a function:
  17.  
  18.         void foo(const char* s)
  19.  
  20. This means 's' is a pointer to a constant char. I.e. I promise not
  21. to modify 's' inside the function.
  22.  
  23. But, how do I declare a function where 's' is a pointer to a pointer
  24. to a contstant char. The following doesn't work quite right:
  25.  
  26.         void foo(const char** s)
  27.  
  28. Because when I try to pass a 'char**' info the function, the compiler
  29. complains about incompatible types. Is it that the const in 
  30. 'const char**' doesn't refer to the 'char'? If so how can I declare
  31. what I mean?
  32.  
  33. Thanks,
  34.  
  35. Guy
  36.  
  37. -- 
  38. Name: Guy Pickering B.Eng A.M.I.E.E
  39. Position: Software Engineer
  40. Company: Redifon MEL Ltd, Newton Rd, Crawley, 
  41.          West Sussex, RH10 2TU. ENGLAND
  42. Tel:  +44 (0)1293 518855   Fax: +44 (0)1293 530101
  43. Mobile: +44 (0)973 129362 (Orange)
  44.  
  45.